﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Raise3000.Code.Helpers
{
    class LoggerHelper
    {
        static private LoggerHelper loggerHelper = null;

        private TextBox generalLog = null;
        private TextBox sqlLog = null;
         
        private LoggerHelper()
        {
        }

        static public LoggerHelper GetLoggerHelper()
        {
            if (loggerHelper == null)
            {
                loggerHelper = new LoggerHelper();
            }
            return loggerHelper;
        }

        public void InitializeGeneralLog(TextBox generalLogTextBox)
        {
            generalLog = generalLogTextBox;
        }

        public void InitializeSQLLog(TextBox sqlLogTextBox)
        {
            sqlLog = sqlLogTextBox;
        }

        /* This the default logger method, writes the message into the general log */
        public void LogMessage(string message)
        {
            generalLog.Text += message + Environment.NewLine;
        }

        private void LogSQLMessage(string message)
        {
            sqlLog.Text += message + Environment.NewLine;
        }
    }
}
